<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>opennars: aruntime/src/main/java/nars/storage/Bag.java Source File</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">opennars
   &#160;<span id="projectnumber">1.5.5</span>
   </div>
   <div id="projectbrief">1.5-ish</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="../../namespaces.html"><span>Packages</span></a></li>
      <li><a href="../../annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="../../files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="../../files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d6/dce/Bag_8java_source.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Bag.java</div>  </div>
</div><!--header-->
<div class="contents">
<a href="../../d6/dce/Bag_8java.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Bag.java</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Copyright (C) 2008  Pei Wang</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * This file is part of Open-NARS.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * Open-NARS is free software; you can redistribute it and/or modify</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * it under the terms of the GNU General Public License as published by</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * the Free Software Foundation, either version 2 of the License, or</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * (at your option) any later version.</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> * Open-NARS is distributed in the hope that it will be useful,</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * GNU General Public License for more details.</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * You should have received a copy of the GNU General Public License</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * along with Open-NARS.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="../../de/ddc/namespacenars_1_1storage.html">   21</a></span>&#160;<span class="keyword">package </span>nars.storage;</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">import</span> java.util.*;</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keyword">import</span> <a class="code" href="../../d7/d81/namespacenars.html">nars</a>.<a class="code" href="../../db/dec/namespacenars_1_1entity.html">entity</a>.<a class="code" href="../../d1/dd1/classnars_1_1entity_1_1Item.html">Item</a>;</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="keyword">import</span> <a class="code" href="../../d7/d81/namespacenars.html">nars</a>.<a class="code" href="../../d9/d79/namespacenars_1_1inference.html">inference</a>.<a class="code" href="../../d7/d11/classnars_1_1inference_1_1BudgetFunctions.html">BudgetFunctions</a>;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag.html">   41</a></span>&#160;<span class="keyword">public</span> <span class="keyword">abstract</span> <span class="keyword">class </span><a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag.html">Bag</a>  &lt;Type <span class="keyword">extends</span> <a class="code" href="../../d1/dd1/classnars_1_1entity_1_1Item.html">Item</a>&gt; {</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe5fd4141c8dbd2d6a143e3db9f3aec.html#a8fe5fd4141c8dbd2d6a143e3db9f3aec">   44</a></span>&#160;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe5fd4141c8dbd2d6a143e3db9f3aec.html#a8fe5fd4141c8dbd2d6a143e3db9f3aec">TOTAL_LEVEL</a> = <a class="code" href="../../d8/df4/classnars_1_1storage_1_1Memory.html">Memory</a>.<a class="code" href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters.html">Parameters</a>.<a class="code" href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters_a7d6b692d645959699544c3e2ad24f131.html#a7d6b692d645959699544c3e2ad24f131">BAG_LEVEL</a>;</div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a94eee3e60812bfa83ee193b99d06b73d.html#a94eee3e60812bfa83ee193b99d06b73d">   46</a></span>&#160;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a94eee3e60812bfa83ee193b99d06b73d.html#a94eee3e60812bfa83ee193b99d06b73d">THRESHOLD</a> = <a class="code" href="../../d8/df4/classnars_1_1storage_1_1Memory.html">Memory</a>.<a class="code" href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters.html">Parameters</a>.<a class="code" href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters_ac515bf0ca3d2fa633b0e2b39c19f7048.html#ac515bf0ca3d2fa633b0e2b39c19f7048">BAG_THRESHOLD</a>;</div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a61d022b3e801efa8cd301a19f1a50ad9.html#a61d022b3e801efa8cd301a19f1a50ad9">   48</a></span>&#160;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keywordtype">float</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a61d022b3e801efa8cd301a19f1a50ad9.html#a61d022b3e801efa8cd301a19f1a50ad9">RELATIVE_THRESHOLD</a> = (float) THRESHOLD / (<span class="keywordtype">float</span>) <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe5fd4141c8dbd2d6a143e3db9f3aec.html#a8fe5fd4141c8dbd2d6a143e3db9f3aec">TOTAL_LEVEL</a>;</div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_ac0d60fa6398f1748f826b23502f703a7.html#ac0d60fa6398f1748f826b23502f703a7">   50</a></span>&#160;    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keywordtype">float</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ac0d60fa6398f1748f826b23502f703a7.html#ac0d60fa6398f1748f826b23502f703a7">LOAD_FACTOR</a> = <a class="code" href="../../d8/df4/classnars_1_1storage_1_1Memory.html">Memory</a>.<a class="code" href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters.html">Parameters</a>.<a class="code" href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters_ad429788f2e96ef25b2bdadbaaa17ba9b.html#ad429788f2e96ef25b2bdadbaaa17ba9b">LOAD_FACTOR</a>;       <span class="comment">//</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8afeef7c22f0624c616c669ad547c3e6.html#a8afeef7c22f0624c616c669ad547c3e6">   52</a></span>&#160;<span class="comment"></span>    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <a class="code" href="../../d2/d34/classnars_1_1storage_1_1Distributor.html">Distributor</a> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8afeef7c22f0624c616c669ad547c3e6.html#a8afeef7c22f0624c616c669ad547c3e6">DISTRIBUTOR</a> = <span class="keyword">new</span> <a class="code" href="../../d2/d34/classnars_1_1storage_1_1Distributor.html">Distributor</a>(TOTAL_LEVEL); <span class="comment">//</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a75f85a5cd6cb57a113006e801e8930b1.html#a75f85a5cd6cb57a113006e801e8930b1">   55</a></span>&#160;<span class="comment"></span>    <span class="keyword">private</span> Map&lt;String, Type&gt; <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a75f85a5cd6cb57a113006e801e8930b1.html#a75f85a5cd6cb57a113006e801e8930b1">nameTable</a>;</div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_ac786087fac1ddca1d938c705ccc814b9.html#ac786087fac1ddca1d938c705ccc814b9">   57</a></span>&#160;    <span class="keyword">private</span> List&lt;ArrayList&lt;Type&gt;&gt; <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ac786087fac1ddca1d938c705ccc814b9.html#ac786087fac1ddca1d938c705ccc814b9">itemTable</a>;</div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_aa274cf4502a32f5c9355961bc4019617.html#aa274cf4502a32f5c9355961bc4019617">   59</a></span>&#160;    <span class="keyword">private</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_aa274cf4502a32f5c9355961bc4019617.html#aa274cf4502a32f5c9355961bc4019617">capacity</a>;</div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a57efe36feb5572fccb6f9a800621ad7d.html#a57efe36feb5572fccb6f9a800621ad7d">   61</a></span>&#160;    <span class="keyword">private</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a57efe36feb5572fccb6f9a800621ad7d.html#a57efe36feb5572fccb6f9a800621ad7d">mass</a>;</div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8f07cefd9e8d035d2ace7fc6cf55e273.html#a8f07cefd9e8d035d2ace7fc6cf55e273">   63</a></span>&#160;    <span class="keyword">private</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8f07cefd9e8d035d2ace7fc6cf55e273.html#a8f07cefd9e8d035d2ace7fc6cf55e273">levelIndex</a>;</div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a62f06ca579b85c4a6c9f0c6899837f34.html#a62f06ca579b85c4a6c9f0c6899837f34">   65</a></span>&#160;    <span class="keyword">private</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a62f06ca579b85c4a6c9f0c6899837f34.html#a62f06ca579b85c4a6c9f0c6899837f34">currentLevel</a>;</div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a2cb578aa2f58ab3bd67df04ae406b335.html#a2cb578aa2f58ab3bd67df04ae406b335">   67</a></span>&#160;    <span class="keyword">private</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a2cb578aa2f58ab3bd67df04ae406b335.html#a2cb578aa2f58ab3bd67df04ae406b335">currentCounter</a>;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    </div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="comment">//    /** whether this bag has an active window */</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="comment">//    private boolean showing;</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="comment">//    /** display window : remove GUI dependency */</span></div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="comment">//    private BagWindow window;</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_acd6809918827ba68d36e467706eb05c0.html#acd6809918827ba68d36e467706eb05c0">   75</a></span>&#160;    <span class="keyword">protected</span> <a class="code" href="../../d8/df4/classnars_1_1storage_1_1Memory.html">Memory</a> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_acd6809918827ba68d36e467706eb05c0.html#acd6809918827ba68d36e467706eb05c0">memory</a>;</div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe67894f51948b0e93f16226822e638.html#a8fe67894f51948b0e93f16226822e638">   76</a></span>&#160;    <span class="keyword">private</span> <a class="code" href="../../df/d32/interfacenars_1_1storage_1_1BagObserver.html">BagObserver</a> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe67894f51948b0e93f16226822e638.html#a8fe67894f51948b0e93f16226822e638">bagObserver</a> = <span class="keyword">new</span> <a class="code" href="../../d4/d76/classnars_1_1storage_1_1NullBagObserver.html">NullBagObserver&lt;Type&gt;</a>();</div>
<div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8bd35d28d93ef17c7c1d1dbbea46abd1.html#a8bd35d28d93ef17c7c1d1dbbea46abd1">   78</a></span>&#160;    <span class="keyword">private</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8bd35d28d93ef17c7c1d1dbbea46abd1.html#a8bd35d28d93ef17c7c1d1dbbea46abd1">showLevel</a> = <a class="code" href="../../d8/df4/classnars_1_1storage_1_1Memory.html">Memory</a>.<a class="code" href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters.html">Parameters</a>.<a class="code" href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters_ac515bf0ca3d2fa633b0e2b39c19f7048.html#ac515bf0ca3d2fa633b0e2b39c19f7048">BAG_THRESHOLD</a>;</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_aed5b14704bbd6f1a94c01fca28c829ba.html#aed5b14704bbd6f1a94c01fca28c829ba">   84</a></span>&#160;    <span class="keyword">protected</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_aed5b14704bbd6f1a94c01fca28c829ba.html#aed5b14704bbd6f1a94c01fca28c829ba">Bag</a>(<a class="code" href="../../d8/df4/classnars_1_1storage_1_1Memory.html">Memory</a> memory) {</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;        this.memory = <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_acd6809918827ba68d36e467706eb05c0.html#acd6809918827ba68d36e467706eb05c0">memory</a>;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="comment">//        showing = false;</span></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        capacity = <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a605afe9ea5c1f272f08bb0be8977eb2a.html#a605afe9ea5c1f272f08bb0be8977eb2a">capacity</a>();</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4f481c434a5a4ac0004138ba81fd426f.html#a4f481c434a5a4ac0004138ba81fd426f">init</a>();</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    }</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;</div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4f481c434a5a4ac0004138ba81fd426f.html#a4f481c434a5a4ac0004138ba81fd426f">   91</a></span>&#160;    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4f481c434a5a4ac0004138ba81fd426f.html#a4f481c434a5a4ac0004138ba81fd426f">init</a>() {</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        itemTable = <span class="keyword">new</span> ArrayList&lt;ArrayList&lt;Type&gt;&gt;(<a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe5fd4141c8dbd2d6a143e3db9f3aec.html#a8fe5fd4141c8dbd2d6a143e3db9f3aec">TOTAL_LEVEL</a>);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe5fd4141c8dbd2d6a143e3db9f3aec.html#a8fe5fd4141c8dbd2d6a143e3db9f3aec">TOTAL_LEVEL</a>; i++) {</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;            itemTable.add(<span class="keyword">new</span> ArrayList&lt;Type&gt;());</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;        }</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        nameTable = <span class="keyword">new</span> HashMap&lt;String, Type&gt;((int) (capacity / LOAD_FACTOR), <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ac0d60fa6398f1748f826b23502f703a7.html#ac0d60fa6398f1748f826b23502f703a7">LOAD_FACTOR</a>);</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        currentLevel = TOTAL_LEVEL - 1;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        levelIndex = capacity % <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe5fd4141c8dbd2d6a143e3db9f3aec.html#a8fe5fd4141c8dbd2d6a143e3db9f3aec">TOTAL_LEVEL</a>; <span class="comment">// so that different bags start at different point</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        mass = 0;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        currentCounter = 0;</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    }</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <span class="keyword">protected</span> <span class="keyword">abstract</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a605afe9ea5c1f272f08bb0be8977eb2a.html#a605afe9ea5c1f272f08bb0be8977eb2a">capacity</a>();</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="keyword">protected</span> <span class="keyword">abstract</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a88362c4d8780e7714393281a98f49683.html#a88362c4d8780e7714393281a98f49683">forgetRate</a>();</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;</div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a5ff587f448a7a832732b4d86eb9a7642.html#a5ff587f448a7a832732b4d86eb9a7642">  120</a></span>&#160;    <span class="keyword">public</span> <span class="keywordtype">float</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a5ff587f448a7a832732b4d86eb9a7642.html#a5ff587f448a7a832732b4d86eb9a7642">averagePriority</a>() {</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;        <span class="keywordflow">if</span> (nameTable.size() == 0) {</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;            <span class="keywordflow">return</span> 0.01f;</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;        }</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;        <span class="keywordtype">float</span> f = (float) mass / (nameTable.size() * <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe5fd4141c8dbd2d6a143e3db9f3aec.html#a8fe5fd4141c8dbd2d6a143e3db9f3aec">TOTAL_LEVEL</a>);</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        <span class="keywordflow">if</span> (f &gt; 1) {</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;            <span class="keywordflow">return</span> 1.0f;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        }</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;        <span class="keywordflow">return</span> f;</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    }</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;</div>
<div class="line"><a name="l00136"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a797bac27645553a6552cef4ab7c27348.html#a797bac27645553a6552cef4ab7c27348">  136</a></span>&#160;    <span class="keyword">public</span> <span class="keywordtype">boolean</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a797bac27645553a6552cef4ab7c27348.html#a797bac27645553a6552cef4ab7c27348">contains</a>(Type it) {</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;        <span class="keywordflow">return</span> nameTable.containsValue(it);</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    }</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;</div>
<div class="line"><a name="l00145"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a011b37fc683db7fb7b41e33712a37d92.html#a011b37fc683db7fb7b41e33712a37d92">  145</a></span>&#160;    <span class="keyword">public</span> Type <span class="keyword">get</span>(String key) {</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        <span class="keywordflow">return</span> nameTable.get(key);</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    }</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div>
<div class="line"><a name="l00154"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a9d42fa45681a07796750a350e08d095b.html#a9d42fa45681a07796750a350e08d095b">  154</a></span>&#160;    <span class="keyword">public</span> <span class="keywordtype">boolean</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a9d42fa45681a07796750a350e08d095b.html#a9d42fa45681a07796750a350e08d095b">putIn</a>(Type newItem) {</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;        String newKey = newItem.getKey();</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;        Type oldItem = nameTable.put(newKey, newItem);</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;        <span class="keywordflow">if</span> (oldItem != null) {                  <span class="comment">// merge duplications</span></div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;            <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ab6b356879b5d95a8c0ce2f36a2727d75.html#ab6b356879b5d95a8c0ce2f36a2727d75">outOfBase</a>(oldItem);</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;            newItem.merge(oldItem);</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;        }</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;        Type overflowItem = <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a405137ac9b2c5e0b6fb836a7ecf5c1e6.html#a405137ac9b2c5e0b6fb836a7ecf5c1e6">intoBase</a>(newItem);  <span class="comment">// put the (new or merged) item into itemTable</span></div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;        <span class="keywordflow">if</span> (overflowItem != null) {             <span class="comment">// remove overflow</span></div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;            String overflowKey = overflowItem.getKey();</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;            nameTable.remove(overflowKey);</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;            <span class="keywordflow">return</span> (overflowItem != newItem);</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        }</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    }</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;</div>
<div class="line"><a name="l00178"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a64b0b75c54e6882a28702d7810094656.html#a64b0b75c54e6882a28702d7810094656">  178</a></span>&#160;    <span class="keyword">public</span> <span class="keywordtype">boolean</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a64b0b75c54e6882a28702d7810094656.html#a64b0b75c54e6882a28702d7810094656">putBack</a>(Type oldItem) {</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;        <a class="code" href="../../d7/d11/classnars_1_1inference_1_1BudgetFunctions.html">BudgetFunctions</a>.<a class="code" href="../../d7/d11/classnars_1_1inference_1_1BudgetFunctions_a7221f4c81db92f40535cffb7f8941b3c.html#a7221f4c81db92f40535cffb7f8941b3c">forget</a>(oldItem.getBudget(), <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a88362c4d8780e7714393281a98f49683.html#a88362c4d8780e7714393281a98f49683">forgetRate</a>(), <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a61d022b3e801efa8cd301a19f1a50ad9.html#a61d022b3e801efa8cd301a19f1a50ad9">RELATIVE_THRESHOLD</a>);</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a9d42fa45681a07796750a350e08d095b.html#a9d42fa45681a07796750a350e08d095b">putIn</a>(oldItem);</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    }</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;</div>
<div class="line"><a name="l00187"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a775c0537431b865015facac73e698891.html#a775c0537431b865015facac73e698891">  187</a></span>&#160;    <span class="keyword">public</span> Type <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a775c0537431b865015facac73e698891.html#a775c0537431b865015facac73e698891">takeOut</a>() {</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;        <span class="keywordflow">if</span> (nameTable.isEmpty()) { <span class="comment">// empty bag</span></div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;            <span class="keywordflow">return</span> null;</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;        }</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;        <span class="keywordflow">if</span> (<a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ae88c5d2e49a385154e243a0f55f1dae6.html#ae88c5d2e49a385154e243a0f55f1dae6">emptyLevel</a>(currentLevel) || (currentCounter == 0)) { <span class="comment">// done with the current level</span></div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;            currentLevel = DISTRIBUTOR.<a class="code" href="../../d2/d34/classnars_1_1storage_1_1Distributor_a469754148f9b6699067d786c8d1db752.html#a469754148f9b6699067d786c8d1db752">pick</a>(levelIndex);</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;            levelIndex = DISTRIBUTOR.<a class="code" href="../../d2/d34/classnars_1_1storage_1_1Distributor_a1390ae3927e77740c61c76bd32cc0476.html#a1390ae3927e77740c61c76bd32cc0476">next</a>(levelIndex);</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;            <span class="keywordflow">while</span> (<a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ae88c5d2e49a385154e243a0f55f1dae6.html#ae88c5d2e49a385154e243a0f55f1dae6">emptyLevel</a>(currentLevel)) {          <span class="comment">// look for a non-empty level</span></div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;                currentLevel = DISTRIBUTOR.<a class="code" href="../../d2/d34/classnars_1_1storage_1_1Distributor_a469754148f9b6699067d786c8d1db752.html#a469754148f9b6699067d786c8d1db752">pick</a>(levelIndex);</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;                levelIndex = DISTRIBUTOR.<a class="code" href="../../d2/d34/classnars_1_1storage_1_1Distributor_a1390ae3927e77740c61c76bd32cc0476.html#a1390ae3927e77740c61c76bd32cc0476">next</a>(levelIndex);</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;            }</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;            <span class="keywordflow">if</span> (currentLevel &lt; THRESHOLD) { <span class="comment">// for dormant levels, take one item</span></div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;                currentCounter = 1;</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;            } <span class="keywordflow">else</span> {                  <span class="comment">// for active levels, take all current items</span></div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;                currentCounter = itemTable.get(currentLevel).size();</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;            }</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;        }</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;        Type selected = <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a7495c60e01c02220dee7528fb6611fae.html#a7495c60e01c02220dee7528fb6611fae">takeOutFirst</a>(currentLevel); <span class="comment">// take out the first item in the level</span></div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        currentCounter--;</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        nameTable.remove(selected.getKey());</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;        <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a61e1d32c91214e604ad392549bea1e7a.html#a61e1d32c91214e604ad392549bea1e7a">refresh</a>();</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;        <span class="keywordflow">return</span> selected;</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;    }</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;</div>
<div class="line"><a name="l00216"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_ac72ca10afde302a1c190a185947781e3.html#ac72ca10afde302a1c190a185947781e3">  216</a></span>&#160;    <span class="keyword">public</span> Type <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ac72ca10afde302a1c190a185947781e3.html#ac72ca10afde302a1c190a185947781e3">pickOut</a>(String key) {</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;        Type picked = nameTable.get(key);</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;        <span class="keywordflow">if</span> (picked != null) {</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;            <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ab6b356879b5d95a8c0ce2f36a2727d75.html#ab6b356879b5d95a8c0ce2f36a2727d75">outOfBase</a>(picked);</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;            nameTable.remove(key);</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;        }</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;        <span class="keywordflow">return</span> picked;</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;    }</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;</div>
<div class="line"><a name="l00230"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_ae88c5d2e49a385154e243a0f55f1dae6.html#ae88c5d2e49a385154e243a0f55f1dae6">  230</a></span>&#160;    <span class="keyword">protected</span> <span class="keywordtype">boolean</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ae88c5d2e49a385154e243a0f55f1dae6.html#ae88c5d2e49a385154e243a0f55f1dae6">emptyLevel</a>(<span class="keywordtype">int</span> n) {</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;        <span class="keywordflow">return</span> ((itemTable.get(n) == null) || itemTable.get(n).isEmpty());</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;    }</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;</div>
<div class="line"><a name="l00239"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a18eb4372ab8e3f4590d8bf66c4084f00.html#a18eb4372ab8e3f4590d8bf66c4084f00">  239</a></span>&#160;    <span class="keyword">private</span> <span class="keywordtype">int</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a18eb4372ab8e3f4590d8bf66c4084f00.html#a18eb4372ab8e3f4590d8bf66c4084f00">getLevel</a>(Type item) {</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;        <span class="keywordtype">float</span> fl = item.getPriority() * <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe5fd4141c8dbd2d6a143e3db9f3aec.html#a8fe5fd4141c8dbd2d6a143e3db9f3aec">TOTAL_LEVEL</a>;</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;        <span class="keywordtype">int</span> level = (int) Math.ceil(fl) - 1;</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;        <span class="keywordflow">return</span> (level &lt; 0) ? 0 : level;     <span class="comment">// cannot be -1</span></div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    }</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;</div>
<div class="line"><a name="l00250"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a405137ac9b2c5e0b6fb836a7ecf5c1e6.html#a405137ac9b2c5e0b6fb836a7ecf5c1e6">  250</a></span>&#160;    <span class="keyword">private</span> Type <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a405137ac9b2c5e0b6fb836a7ecf5c1e6.html#a405137ac9b2c5e0b6fb836a7ecf5c1e6">intoBase</a>(Type newItem) {</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;        Type oldItem = null;</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;        <span class="keywordtype">int</span> inLevel = <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a18eb4372ab8e3f4590d8bf66c4084f00.html#a18eb4372ab8e3f4590d8bf66c4084f00">getLevel</a>(newItem);</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;        <span class="keywordflow">if</span> (nameTable.size() &gt; <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a605afe9ea5c1f272f08bb0be8977eb2a.html#a605afe9ea5c1f272f08bb0be8977eb2a">capacity</a>) {      <span class="comment">// the bag is full</span></div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;            <span class="keywordtype">int</span> outLevel = 0;</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;            <span class="keywordflow">while</span> (<a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ae88c5d2e49a385154e243a0f55f1dae6.html#ae88c5d2e49a385154e243a0f55f1dae6">emptyLevel</a>(outLevel)) {</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;                outLevel++;</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;            }</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;            <span class="keywordflow">if</span> (outLevel &gt; inLevel) {           <span class="comment">// ignore the item and exit</span></div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;                <span class="keywordflow">return</span> newItem;</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;            } <span class="keywordflow">else</span> {                            <span class="comment">// remove an old item in the lowest non-empty level</span></div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;                oldItem = <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a7495c60e01c02220dee7528fb6611fae.html#a7495c60e01c02220dee7528fb6611fae">takeOutFirst</a>(outLevel);</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;            }</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        }</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;        itemTable.get(inLevel).add(newItem);        <span class="comment">// FIFO</span></div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;        mass += (inLevel + 1);                  <span class="comment">// increase total mass</span></div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;        <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a61e1d32c91214e604ad392549bea1e7a.html#a61e1d32c91214e604ad392549bea1e7a">refresh</a>();                              <span class="comment">// refresh the window</span></div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;        <span class="keywordflow">return</span> oldItem;     <span class="comment">// TODO return null is a bad smell</span></div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;    }</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;</div>
<div class="line"><a name="l00275"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a7495c60e01c02220dee7528fb6611fae.html#a7495c60e01c02220dee7528fb6611fae">  275</a></span>&#160;    <span class="keyword">private</span> Type <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a7495c60e01c02220dee7528fb6611fae.html#a7495c60e01c02220dee7528fb6611fae">takeOutFirst</a>(<span class="keywordtype">int</span> level) {</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;        Type selected = itemTable.get(level).get(0);</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;        itemTable.get(level).remove(0);</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;        mass -= (level + 1);</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;        <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a61e1d32c91214e604ad392549bea1e7a.html#a61e1d32c91214e604ad392549bea1e7a">refresh</a>();</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;        <span class="keywordflow">return</span> selected;</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;    }</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;</div>
<div class="line"><a name="l00287"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_ab6b356879b5d95a8c0ce2f36a2727d75.html#ab6b356879b5d95a8c0ce2f36a2727d75">  287</a></span>&#160;    <span class="keyword">protected</span> <span class="keywordtype">void</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ab6b356879b5d95a8c0ce2f36a2727d75.html#ab6b356879b5d95a8c0ce2f36a2727d75">outOfBase</a>(Type oldItem) {</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;        <span class="keywordtype">int</span> level = <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a18eb4372ab8e3f4590d8bf66c4084f00.html#a18eb4372ab8e3f4590d8bf66c4084f00">getLevel</a>(oldItem);</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;        itemTable.get(level).remove(oldItem);</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;        mass -= (level + 1);</div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;        <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a61e1d32c91214e604ad392549bea1e7a.html#a61e1d32c91214e604ad392549bea1e7a">refresh</a>();</div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;    }</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;</div>
<div class="line"><a name="l00303"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a73a559e1b77e6bc3a7db686816accef2.html#a73a559e1b77e6bc3a7db686816accef2">  303</a></span>&#160;    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a73a559e1b77e6bc3a7db686816accef2.html#a73a559e1b77e6bc3a7db686816accef2">addBagObserver</a>(<a class="code" href="../../df/d32/interfacenars_1_1storage_1_1BagObserver.html">BagObserver</a> bagObserver, String title) {</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;        this.bagObserver = <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe67894f51948b0e93f16226822e638.html#a8fe67894f51948b0e93f16226822e638">bagObserver</a>;</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;        bagObserver.<a class="code" href="../../df/d32/interfacenars_1_1storage_1_1BagObserver_a47cd6e934d34485e07b1f1d793d43eee.html#a47cd6e934d34485e07b1f1d793d43eee">post</a>(<a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4106abcc906c5ae1ce6828b0a88a1cca.html#a4106abcc906c5ae1ce6828b0a88a1cca">toString</a>());</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;        bagObserver.<a class="code" href="../../df/d32/interfacenars_1_1storage_1_1BagObserver_a11b5571052cf899abfac1e8930af0c4c.html#a11b5571052cf899abfac1e8930af0c4c">setTitle</a>(title);</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;<span class="comment">//        window = new BagWindow(this, title);</span></div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;<span class="comment">//        showing = true;</span></div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;<span class="comment">//        window.post(toString());</span></div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;    }</div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;</div>
<div class="line"><a name="l00315"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_aa47288dac94f3473bcb77afe929c0fc4.html#aa47288dac94f3473bcb77afe929c0fc4">  315</a></span>&#160;    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_aa47288dac94f3473bcb77afe929c0fc4.html#aa47288dac94f3473bcb77afe929c0fc4">play</a>() {</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;        bagObserver.<a class="code" href="../../df/d32/interfacenars_1_1storage_1_1BagObserver_a47cd6e934d34485e07b1f1d793d43eee.html#a47cd6e934d34485e07b1f1d793d43eee">post</a>(<a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4106abcc906c5ae1ce6828b0a88a1cca.html#a4106abcc906c5ae1ce6828b0a88a1cca">toString</a>());</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;<span class="comment">//        showing = true;</span></div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;<span class="comment">//        window.post(toString());</span></div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;    }</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;</div>
<div class="line"><a name="l00324"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_af0c5acd21f1e0d1495f56d4b1bce2abe.html#af0c5acd21f1e0d1495f56d4b1bce2abe">  324</a></span>&#160;    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_af0c5acd21f1e0d1495f56d4b1bce2abe.html#af0c5acd21f1e0d1495f56d4b1bce2abe">stop</a>() {</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;        bagObserver.<a class="code" href="../../df/d32/interfacenars_1_1storage_1_1BagObserver_a8043d36abad3be35a37b2846ba400997.html#a8043d36abad3be35a37b2846ba400997">stop</a>();</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;<span class="comment">//        showing = false;</span></div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    }</div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;    </div>
<div class="line"><a name="l00332"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a61e1d32c91214e604ad392549bea1e7a.html#a61e1d32c91214e604ad392549bea1e7a">  332</a></span>&#160;    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a61e1d32c91214e604ad392549bea1e7a.html#a61e1d32c91214e604ad392549bea1e7a">refresh</a>() {</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;        bagObserver.<a class="code" href="../../df/d32/interfacenars_1_1storage_1_1BagObserver_a0b3613931378d6e499176760f6390990.html#a0b3613931378d6e499176760f6390990">refresh</a>(<a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4106abcc906c5ae1ce6828b0a88a1cca.html#a4106abcc906c5ae1ce6828b0a88a1cca">toString</a>());</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;<span class="comment">//        if (showing) {</span></div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;<span class="comment">//            window.post(toString());</span></div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;<span class="comment">//        }</span></div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    }</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;</div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;    @Override</div>
<div class="line"><a name="l00343"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4106abcc906c5ae1ce6828b0a88a1cca.html#a4106abcc906c5ae1ce6828b0a88a1cca">  343</a></span>&#160;    <span class="keyword">public</span> String <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4106abcc906c5ae1ce6828b0a88a1cca.html#a4106abcc906c5ae1ce6828b0a88a1cca">toString</a>() {</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;        StringBuffer buf = <span class="keyword">new</span> StringBuffer(<span class="stringliteral">&quot; &quot;</span>);</div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;<span class="comment">//        int showLevel = window == null ? 1 : window.showLevel();</span></div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = TOTAL_LEVEL; i &gt;= <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8bd35d28d93ef17c7c1d1dbbea46abd1.html#a8bd35d28d93ef17c7c1d1dbbea46abd1">showLevel</a> ; i--) {</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;            <span class="keywordflow">if</span> (!<a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ae88c5d2e49a385154e243a0f55f1dae6.html#ae88c5d2e49a385154e243a0f55f1dae6">emptyLevel</a>(i - 1)) {</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;                buf = buf.append(<span class="stringliteral">&quot;\n --- Level &quot;</span> + i + <span class="stringliteral">&quot;:\n &quot;</span>);</div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;                <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; itemTable.get(i - 1).size(); j++) {</div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;                    buf = buf.append(itemTable.get(i - 1).get(j).toStringBrief() + <span class="stringliteral">&quot;\n &quot;</span>);</div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;                }</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;            }</div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;        }</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;        <span class="keywordflow">return</span> buf.toString();</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;    }</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;    </div>
<div class="line"><a name="l00358"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_adff1bdb7ded17b66dc84068e49571ba7.html#adff1bdb7ded17b66dc84068e49571ba7">  358</a></span>&#160;    <span class="keyword">public</span> String <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_adff1bdb7ded17b66dc84068e49571ba7.html#adff1bdb7ded17b66dc84068e49571ba7">toStringLong</a>() {</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;        StringBuffer buf = <span class="keyword">new</span> StringBuffer(<span class="stringliteral">&quot; BAG &quot;</span> + getClass().getSimpleName() );</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;        buf.append(<span class="stringliteral">&quot; &quot;</span>).append( <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4d2b0529a22c384840f63a7b463d62aa.html#a4d2b0529a22c384840f63a7b463d62aa">showSizes</a>() );</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = TOTAL_LEVEL; i &gt;= <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8bd35d28d93ef17c7c1d1dbbea46abd1.html#a8bd35d28d93ef17c7c1d1dbbea46abd1">showLevel</a>; i--) {</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;            <span class="keywordflow">if</span> (!<a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_ae88c5d2e49a385154e243a0f55f1dae6.html#ae88c5d2e49a385154e243a0f55f1dae6">emptyLevel</a>(i - 1)) {</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;                buf = buf.append(<span class="stringliteral">&quot;\n --- LEVEL &quot;</span> + i + <span class="stringliteral">&quot;:\n &quot;</span>);</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;                <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; itemTable.get(i - 1).size(); j++) {</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;                    buf = buf.append(itemTable.get(i - 1).get(j).toStringLong() + <span class="stringliteral">&quot;\n &quot;</span>);</div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;                }</div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;            }</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;        }</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;        buf.append(<span class="stringliteral">&quot;&gt;&gt;&gt;&gt; end of Bag&quot;</span>).append( getClass().getSimpleName() );</div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;        <span class="keywordflow">return</span> buf.toString();</div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;    }</div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;    </div>
<div class="line"><a name="l00373"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4d2b0529a22c384840f63a7b463d62aa.html#a4d2b0529a22c384840f63a7b463d62aa">  373</a></span>&#160;    String <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a4d2b0529a22c384840f63a7b463d62aa.html#a4d2b0529a22c384840f63a7b463d62aa">showSizes</a>() {</div>
<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;        StringBuilder buf = <span class="keyword">new</span> StringBuilder(<span class="stringliteral">&quot; &quot;</span>);</div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;        <span class="keywordtype">int</span> levels = 0;</div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;        <span class="keywordflow">for</span> ( List&lt;Type&gt; items : itemTable) {</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;            <span class="keywordflow">if</span> ((items != null) &amp;&amp; ! items.isEmpty()) {</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;                levels++;</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;                buf.append( items.size() ).append( <span class="stringliteral">&quot; &quot;</span> );</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;            }</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;        }</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;        <span class="keywordflow">return</span> <span class="stringliteral">&quot;Levels: &quot;</span> + Integer.toString( levels ) + <span class="stringliteral">&quot;, sizes: &quot;</span> + buf;</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;    }</div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;</div>
<div class="line"><a name="l00385"></a><span class="lineno"><a class="line" href="../../d9/d37/classnars_1_1storage_1_1Bag_aedbf55ee31532adc4a5e4d0d3691f28a.html#aedbf55ee31532adc4a5e4d0d3691f28a">  385</a></span>&#160;    <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_aedbf55ee31532adc4a5e4d0d3691f28a.html#aedbf55ee31532adc4a5e4d0d3691f28a">setShowLevel</a>(<span class="keywordtype">int</span> showLevel) {</div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;        this.showLevel = <a class="code" href="../../d9/d37/classnars_1_1storage_1_1Bag_a8bd35d28d93ef17c7c1d1dbbea46abd1.html#a8bd35d28d93ef17c7c1d1dbbea46abd1">showLevel</a>;</div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;    }</div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;}</div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a4106abcc906c5ae1ce6828b0a88a1cca_html_a4106abcc906c5ae1ce6828b0a88a1cca"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a4106abcc906c5ae1ce6828b0a88a1cca.html#a4106abcc906c5ae1ce6828b0a88a1cca">nars.storage.Bag.toString</a></div><div class="ttdeci">String toString()</div><div class="ttdoc">Collect Bag content into a String for display. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00343">Bag.java:343</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_ae88c5d2e49a385154e243a0f55f1dae6_html_ae88c5d2e49a385154e243a0f55f1dae6"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_ae88c5d2e49a385154e243a0f55f1dae6.html#ae88c5d2e49a385154e243a0f55f1dae6">nars.storage.Bag.emptyLevel</a></div><div class="ttdeci">boolean emptyLevel(int n)</div><div class="ttdoc">Check whether a level is empty. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00230">Bag.java:230</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a4f481c434a5a4ac0004138ba81fd426f_html_a4f481c434a5a4ac0004138ba81fd426f"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a4f481c434a5a4ac0004138ba81fd426f.html#a4f481c434a5a4ac0004138ba81fd426f">nars.storage.Bag.init</a></div><div class="ttdeci">void init()</div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00091">Bag.java:91</a></div></div>
<div class="ttc" id="namespacenars_1_1entity_html"><div class="ttname"><a href="../../db/dec/namespacenars_1_1entity.html">nars.entity</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d8/d59/BudgetValue_8java_source.html#l00021">BudgetValue.java:21</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a2cb578aa2f58ab3bd67df04ae406b335_html_a2cb578aa2f58ab3bd67df04ae406b335"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a2cb578aa2f58ab3bd67df04ae406b335.html#a2cb578aa2f58ab3bd67df04ae406b335">nars.storage.Bag.currentCounter</a></div><div class="ttdeci">int currentCounter</div><div class="ttdoc">maximum number of items to be taken out at current level </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00067">Bag.java:67</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a775c0537431b865015facac73e698891_html_a775c0537431b865015facac73e698891"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a775c0537431b865015facac73e698891.html#a775c0537431b865015facac73e698891">nars.storage.Bag.takeOut</a></div><div class="ttdeci">Type takeOut()</div><div class="ttdoc">Choose an Item according to priority distribution and take it out of the Bag. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00187">Bag.java:187</a></div></div>
<div class="ttc" id="interfacenars_1_1storage_1_1BagObserver_a0b3613931378d6e499176760f6390990_html_a0b3613931378d6e499176760f6390990"><div class="ttname"><a href="../../df/d32/interfacenars_1_1storage_1_1BagObserver_a0b3613931378d6e499176760f6390990.html#a0b3613931378d6e499176760f6390990">nars.storage.BagObserver.refresh</a></div><div class="ttdeci">void refresh(String string)</div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_aed5b14704bbd6f1a94c01fca28c829ba_html_aed5b14704bbd6f1a94c01fca28c829ba"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_aed5b14704bbd6f1a94c01fca28c829ba.html#aed5b14704bbd6f1a94c01fca28c829ba">nars.storage.Bag.Bag</a></div><div class="ttdeci">Bag(Memory memory)</div><div class="ttdoc">constructor, called from subclasses </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00084">Bag.java:84</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Distributor_a1390ae3927e77740c61c76bd32cc0476_html_a1390ae3927e77740c61c76bd32cc0476"><div class="ttname"><a href="../../d2/d34/classnars_1_1storage_1_1Distributor_a1390ae3927e77740c61c76bd32cc0476.html#a1390ae3927e77740c61c76bd32cc0476">nars.storage.Distributor.next</a></div><div class="ttdeci">int next(int index)</div><div class="ttdoc">Advance the index. </div><div class="ttdef"><b>Definition:</b> <a href="../../d9/d44/Distributor_8java_source.html#l00076">Distributor.java:76</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a5ff587f448a7a832732b4d86eb9a7642_html_a5ff587f448a7a832732b4d86eb9a7642"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a5ff587f448a7a832732b4d86eb9a7642.html#a5ff587f448a7a832732b4d86eb9a7642">nars.storage.Bag.averagePriority</a></div><div class="ttdeci">float averagePriority()</div><div class="ttdoc">Get the average priority of Items. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00120">Bag.java:120</a></div></div>
<div class="ttc" id="classnars_1_1entity_1_1Item_html"><div class="ttname"><a href="../../d1/dd1/classnars_1_1entity_1_1Item.html">nars.entity.Item</a></div><div class="ttdoc">An item is an object that can be put into a Bag, to participate in the resource competition of the sy...</div><div class="ttdef"><b>Definition:</b> <a href="../../d9/de0/Item_8java_source.html#l00031">Item.java:31</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Memory_html"><div class="ttname"><a href="../../d8/df4/classnars_1_1storage_1_1Memory.html">nars.storage.Memory</a></div><div class="ttdoc">The memory of the system. </div><div class="ttdef"><b>Definition:</b> <a href="../../db/d0c/Memory_8java_source.html#l00051">Memory.java:51</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Distributor_html"><div class="ttname"><a href="../../d2/d34/classnars_1_1storage_1_1Distributor.html">nars.storage.Distributor</a></div><div class="ttdoc">A pseudo-random number generator, used in Bag. </div><div class="ttdef"><b>Definition:</b> <a href="../../d9/d44/Distributor_8java_source.html#l00026">Distributor.java:26</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Memory_1_1Parameters_html"><div class="ttname"><a href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters.html">nars.storage.Memory.Parameters</a></div><div class="ttdoc">Collected system parameters. </div><div class="ttdef"><b>Definition:</b> <a href="../../db/d0c/Memory_8java_source.html#l01069">Memory.java:1069</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a64b0b75c54e6882a28702d7810094656_html_a64b0b75c54e6882a28702d7810094656"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a64b0b75c54e6882a28702d7810094656.html#a64b0b75c54e6882a28702d7810094656">nars.storage.Bag.putBack</a></div><div class="ttdeci">boolean putBack(Type oldItem)</div><div class="ttdoc">Put an item back into the itemTable. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00178">Bag.java:178</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Memory_1_1Parameters_a7d6b692d645959699544c3e2ad24f131_html_a7d6b692d645959699544c3e2ad24f131"><div class="ttname"><a href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters_a7d6b692d645959699544c3e2ad24f131.html#a7d6b692d645959699544c3e2ad24f131">nars.storage.Memory.Parameters.BAG_LEVEL</a></div><div class="ttdeci">static final int BAG_LEVEL</div><div class="ttdoc">Level granularity in Bag, two digits. </div><div class="ttdef"><b>Definition:</b> <a href="../../db/d0c/Memory_8java_source.html#l01118">Memory.java:1118</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Distributor_a469754148f9b6699067d786c8d1db752_html_a469754148f9b6699067d786c8d1db752"><div class="ttname"><a href="../../d2/d34/classnars_1_1storage_1_1Distributor_a469754148f9b6699067d786c8d1db752.html#a469754148f9b6699067d786c8d1db752">nars.storage.Distributor.pick</a></div><div class="ttdeci">int pick(int index)</div><div class="ttdoc">Get the next number according to the given index. </div><div class="ttdef"><b>Definition:</b> <a href="../../d9/d44/Distributor_8java_source.html#l00065">Distributor.java:65</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a7495c60e01c02220dee7528fb6611fae_html_a7495c60e01c02220dee7528fb6611fae"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a7495c60e01c02220dee7528fb6611fae.html#a7495c60e01c02220dee7528fb6611fae">nars.storage.Bag.takeOutFirst</a></div><div class="ttdeci">Type takeOutFirst(int level)</div><div class="ttdoc">Take out the first or last Type in a level from the itemTable. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00275">Bag.java:275</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a8fe67894f51948b0e93f16226822e638_html_a8fe67894f51948b0e93f16226822e638"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe67894f51948b0e93f16226822e638.html#a8fe67894f51948b0e93f16226822e638">nars.storage.Bag.bagObserver</a></div><div class="ttdeci">BagObserver bagObserver</div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00076">Bag.java:76</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_ac0d60fa6398f1748f826b23502f703a7_html_ac0d60fa6398f1748f826b23502f703a7"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_ac0d60fa6398f1748f826b23502f703a7.html#ac0d60fa6398f1748f826b23502f703a7">nars.storage.Bag.LOAD_FACTOR</a></div><div class="ttdeci">static final float LOAD_FACTOR</div><div class="ttdoc">hashtable load factor </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00050">Bag.java:50</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_aa274cf4502a32f5c9355961bc4019617_html_aa274cf4502a32f5c9355961bc4019617"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_aa274cf4502a32f5c9355961bc4019617.html#aa274cf4502a32f5c9355961bc4019617">nars.storage.Bag.capacity</a></div><div class="ttdeci">int capacity</div><div class="ttdoc">defined in different bags </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00059">Bag.java:59</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a61e1d32c91214e604ad392549bea1e7a_html_a61e1d32c91214e604ad392549bea1e7a"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a61e1d32c91214e604ad392549bea1e7a.html#a61e1d32c91214e604ad392549bea1e7a">nars.storage.Bag.refresh</a></div><div class="ttdeci">void refresh()</div><div class="ttdoc">Refresh display. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00332">Bag.java:332</a></div></div>
<div class="ttc" id="namespacenars_1_1inference_html"><div class="ttname"><a href="../../d9/d79/namespacenars_1_1inference.html">nars.inference</a></div><div class="ttdef"><b>Definition:</b> <a href="../../de/d4e/BudgetFunctions_8java_source.html#l00021">BudgetFunctions.java:21</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a62f06ca579b85c4a6c9f0c6899837f34_html_a62f06ca579b85c4a6c9f0c6899837f34"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a62f06ca579b85c4a6c9f0c6899837f34.html#a62f06ca579b85c4a6c9f0c6899837f34">nars.storage.Bag.currentLevel</a></div><div class="ttdeci">int currentLevel</div><div class="ttdoc">current take out level </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00065">Bag.java:65</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_ac72ca10afde302a1c190a185947781e3_html_ac72ca10afde302a1c190a185947781e3"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_ac72ca10afde302a1c190a185947781e3.html#ac72ca10afde302a1c190a185947781e3">nars.storage.Bag.pickOut</a></div><div class="ttdeci">Type pickOut(String key)</div><div class="ttdoc">Pick an item by key, then remove it from the bag. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00216">Bag.java:216</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a9d42fa45681a07796750a350e08d095b_html_a9d42fa45681a07796750a350e08d095b"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a9d42fa45681a07796750a350e08d095b.html#a9d42fa45681a07796750a350e08d095b">nars.storage.Bag.putIn</a></div><div class="ttdeci">boolean putIn(Type newItem)</div><div class="ttdoc">Add a new Item into the Bag. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00154">Bag.java:154</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a61d022b3e801efa8cd301a19f1a50ad9_html_a61d022b3e801efa8cd301a19f1a50ad9"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a61d022b3e801efa8cd301a19f1a50ad9.html#a61d022b3e801efa8cd301a19f1a50ad9">nars.storage.Bag.RELATIVE_THRESHOLD</a></div><div class="ttdeci">static final float RELATIVE_THRESHOLD</div><div class="ttdoc">relative threshold, only calculate once </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00048">Bag.java:48</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_af0c5acd21f1e0d1495f56d4b1bce2abe_html_af0c5acd21f1e0d1495f56d4b1bce2abe"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_af0c5acd21f1e0d1495f56d4b1bce2abe.html#af0c5acd21f1e0d1495f56d4b1bce2abe">nars.storage.Bag.stop</a></div><div class="ttdeci">void stop()</div><div class="ttdoc">Stop display. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00324">Bag.java:324</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_aedbf55ee31532adc4a5e4d0d3691f28a_html_aedbf55ee31532adc4a5e4d0d3691f28a"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_aedbf55ee31532adc4a5e4d0d3691f28a.html#aedbf55ee31532adc4a5e4d0d3691f28a">nars.storage.Bag.setShowLevel</a></div><div class="ttdeci">void setShowLevel(int showLevel)</div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00385">Bag.java:385</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_html"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag.html">nars.storage.Bag</a></div><div class="ttdoc">A Bag is a storage with a constant capacity and maintains an internal priority distribution for retri...</div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00041">Bag.java:41</a></div></div>
<div class="ttc" id="namespacenars_html"><div class="ttname"><a href="../../d7/d81/namespacenars.html">nars</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1NullBagObserver_html"><div class="ttname"><a href="../../d4/d76/classnars_1_1storage_1_1NullBagObserver.html">nars.storage.NullBagObserver</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d15/NullBagObserver_8java_source.html#l00003">NullBagObserver.java:3</a></div></div>
<div class="ttc" id="classnars_1_1inference_1_1BudgetFunctions_a7221f4c81db92f40535cffb7f8941b3c_html_a7221f4c81db92f40535cffb7f8941b3c"><div class="ttname"><a href="../../d7/d11/classnars_1_1inference_1_1BudgetFunctions_a7221f4c81db92f40535cffb7f8941b3c.html#a7221f4c81db92f40535cffb7f8941b3c">nars.inference.BudgetFunctions.forget</a></div><div class="ttdeci">static void forget(BudgetStruct budget, float forgetRate, float relativeThreshold)</div><div class="ttdoc">Decrease Priority after an item is used, called in Bag. </div><div class="ttdef"><b>Definition:</b> <a href="../../de/d4e/BudgetFunctions_8java_source.html#l00211">BudgetFunctions.java:211</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a8afeef7c22f0624c616c669ad547c3e6_html_a8afeef7c22f0624c616c669ad547c3e6"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a8afeef7c22f0624c616c669ad547c3e6.html#a8afeef7c22f0624c616c669ad547c3e6">nars.storage.Bag.DISTRIBUTOR</a></div><div class="ttdeci">static final Distributor DISTRIBUTOR</div><div class="ttdoc">shared DISTRIBUTOR that produce the probability distribution </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00052">Bag.java:52</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a94eee3e60812bfa83ee193b99d06b73d_html_a94eee3e60812bfa83ee193b99d06b73d"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a94eee3e60812bfa83ee193b99d06b73d.html#a94eee3e60812bfa83ee193b99d06b73d">nars.storage.Bag.THRESHOLD</a></div><div class="ttdeci">static final int THRESHOLD</div><div class="ttdoc">firing threshold </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00046">Bag.java:46</a></div></div>
<div class="ttc" id="classnars_1_1inference_1_1BudgetFunctions_html"><div class="ttname"><a href="../../d7/d11/classnars_1_1inference_1_1BudgetFunctions.html">nars.inference.BudgetFunctions</a></div><div class="ttdoc">Budget functions for resources allocation. </div><div class="ttdef"><b>Definition:</b> <a href="../../de/d4e/BudgetFunctions_8java_source.html#l00031">BudgetFunctions.java:31</a></div></div>
<div class="ttc" id="interfacenars_1_1storage_1_1BagObserver_a8043d36abad3be35a37b2846ba400997_html_a8043d36abad3be35a37b2846ba400997"><div class="ttname"><a href="../../df/d32/interfacenars_1_1storage_1_1BagObserver_a8043d36abad3be35a37b2846ba400997.html#a8043d36abad3be35a37b2846ba400997">nars.storage.BagObserver.stop</a></div><div class="ttdeci">void stop()</div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a75f85a5cd6cb57a113006e801e8930b1_html_a75f85a5cd6cb57a113006e801e8930b1"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a75f85a5cd6cb57a113006e801e8930b1.html#a75f85a5cd6cb57a113006e801e8930b1">nars.storage.Bag.nameTable</a></div><div class="ttdeci">Map&lt; String, Type &gt; nameTable</div><div class="ttdoc">mapping from key to item </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00055">Bag.java:55</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a73a559e1b77e6bc3a7db686816accef2_html_a73a559e1b77e6bc3a7db686816accef2"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a73a559e1b77e6bc3a7db686816accef2.html#a73a559e1b77e6bc3a7db686816accef2">nars.storage.Bag.addBagObserver</a></div><div class="ttdeci">void addBagObserver(BagObserver bagObserver, String title)</div><div class="ttdoc">To start displaying the Bag in a BagWindow. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00303">Bag.java:303</a></div></div>
<div class="ttc" id="interfacenars_1_1storage_1_1BagObserver_a47cd6e934d34485e07b1f1d793d43eee_html_a47cd6e934d34485e07b1f1d793d43eee"><div class="ttname"><a href="../../df/d32/interfacenars_1_1storage_1_1BagObserver_a47cd6e934d34485e07b1f1d793d43eee.html#a47cd6e934d34485e07b1f1d793d43eee">nars.storage.BagObserver.post</a></div><div class="ttdeci">void post(String str)</div><div class="ttdoc">Post the bag content. </div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a8f07cefd9e8d035d2ace7fc6cf55e273_html_a8f07cefd9e8d035d2ace7fc6cf55e273"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a8f07cefd9e8d035d2ace7fc6cf55e273.html#a8f07cefd9e8d035d2ace7fc6cf55e273">nars.storage.Bag.levelIndex</a></div><div class="ttdeci">int levelIndex</div><div class="ttdoc">index to get next level, kept in individual objects </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00063">Bag.java:63</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_ac786087fac1ddca1d938c705ccc814b9_html_ac786087fac1ddca1d938c705ccc814b9"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_ac786087fac1ddca1d938c705ccc814b9.html#ac786087fac1ddca1d938c705ccc814b9">nars.storage.Bag.itemTable</a></div><div class="ttdeci">List&lt; ArrayList&lt; Type &gt; &gt; itemTable</div><div class="ttdoc">array of lists of items, for items on different level </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00057">Bag.java:57</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_aa47288dac94f3473bcb77afe929c0fc4_html_aa47288dac94f3473bcb77afe929c0fc4"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_aa47288dac94f3473bcb77afe929c0fc4.html#aa47288dac94f3473bcb77afe929c0fc4">nars.storage.Bag.play</a></div><div class="ttdeci">void play()</div><div class="ttdoc">Resume display. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00315">Bag.java:315</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a605afe9ea5c1f272f08bb0be8977eb2a_html_a605afe9ea5c1f272f08bb0be8977eb2a"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a605afe9ea5c1f272f08bb0be8977eb2a.html#a605afe9ea5c1f272f08bb0be8977eb2a">nars.storage.Bag.capacity</a></div><div class="ttdeci">abstract int capacity()</div><div class="ttdoc">To get the capacity of the concrete subclass. </div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a8fe5fd4141c8dbd2d6a143e3db9f3aec_html_a8fe5fd4141c8dbd2d6a143e3db9f3aec"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a8fe5fd4141c8dbd2d6a143e3db9f3aec.html#a8fe5fd4141c8dbd2d6a143e3db9f3aec">nars.storage.Bag.TOTAL_LEVEL</a></div><div class="ttdeci">static final int TOTAL_LEVEL</div><div class="ttdoc">priority levels </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00044">Bag.java:44</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a8bd35d28d93ef17c7c1d1dbbea46abd1_html_a8bd35d28d93ef17c7c1d1dbbea46abd1"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a8bd35d28d93ef17c7c1d1dbbea46abd1.html#a8bd35d28d93ef17c7c1d1dbbea46abd1">nars.storage.Bag.showLevel</a></div><div class="ttdeci">int showLevel</div><div class="ttdoc">The lowest display level. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00078">Bag.java:78</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Memory_1_1Parameters_ad429788f2e96ef25b2bdadbaaa17ba9b_html_ad429788f2e96ef25b2bdadbaaa17ba9b"><div class="ttname"><a href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters_ad429788f2e96ef25b2bdadbaaa17ba9b.html#ad429788f2e96ef25b2bdadbaaa17ba9b">nars.storage.Memory.Parameters.LOAD_FACTOR</a></div><div class="ttdeci">static final float LOAD_FACTOR</div><div class="ttdoc">Hashtable load factor in Bag. </div><div class="ttdef"><b>Definition:</b> <a href="../../db/d0c/Memory_8java_source.html#l01125">Memory.java:1125</a></div></div>
<div class="ttc" id="interfacenars_1_1storage_1_1BagObserver_html"><div class="ttname"><a href="../../df/d32/interfacenars_1_1storage_1_1BagObserver.html">nars.storage.BagObserver</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d8/de1/BagObserver_8java_source.html#l00003">BagObserver.java:3</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a18eb4372ab8e3f4590d8bf66c4084f00_html_a18eb4372ab8e3f4590d8bf66c4084f00"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a18eb4372ab8e3f4590d8bf66c4084f00.html#a18eb4372ab8e3f4590d8bf66c4084f00">nars.storage.Bag.getLevel</a></div><div class="ttdeci">int getLevel(Type item)</div><div class="ttdoc">Decide the put-in level according to priority. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00239">Bag.java:239</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Memory_1_1Parameters_ac515bf0ca3d2fa633b0e2b39c19f7048_html_ac515bf0ca3d2fa633b0e2b39c19f7048"><div class="ttname"><a href="../../da/d3b/classnars_1_1storage_1_1Memory_1_1Parameters_ac515bf0ca3d2fa633b0e2b39c19f7048.html#ac515bf0ca3d2fa633b0e2b39c19f7048">nars.storage.Memory.Parameters.BAG_THRESHOLD</a></div><div class="ttdeci">static final int BAG_THRESHOLD</div><div class="ttdoc">Level separation in Bag, one digit, for display (run-time adjustable) and management (fixed) ...</div><div class="ttdef"><b>Definition:</b> <a href="../../db/d0c/Memory_8java_source.html#l01123">Memory.java:1123</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a88362c4d8780e7714393281a98f49683_html_a88362c4d8780e7714393281a98f49683"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a88362c4d8780e7714393281a98f49683.html#a88362c4d8780e7714393281a98f49683">nars.storage.Bag.forgetRate</a></div><div class="ttdeci">abstract int forgetRate()</div><div class="ttdoc">Get the item decay rate, which differs in difference subclass, and can be changed in run time by the ...</div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a405137ac9b2c5e0b6fb836a7ecf5c1e6_html_a405137ac9b2c5e0b6fb836a7ecf5c1e6"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a405137ac9b2c5e0b6fb836a7ecf5c1e6.html#a405137ac9b2c5e0b6fb836a7ecf5c1e6">nars.storage.Bag.intoBase</a></div><div class="ttdeci">Type intoBase(Type newItem)</div><div class="ttdoc">Insert an item into the itemTable, and return the overflow. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00250">Bag.java:250</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a797bac27645553a6552cef4ab7c27348_html_a797bac27645553a6552cef4ab7c27348"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a797bac27645553a6552cef4ab7c27348.html#a797bac27645553a6552cef4ab7c27348">nars.storage.Bag.contains</a></div><div class="ttdeci">boolean contains(Type it)</div><div class="ttdoc">Check if an item is in the bag. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00136">Bag.java:136</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_ab6b356879b5d95a8c0ce2f36a2727d75_html_ab6b356879b5d95a8c0ce2f36a2727d75"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_ab6b356879b5d95a8c0ce2f36a2727d75.html#ab6b356879b5d95a8c0ce2f36a2727d75">nars.storage.Bag.outOfBase</a></div><div class="ttdeci">void outOfBase(Type oldItem)</div><div class="ttdoc">Remove an item from itemTable, then adjust mass. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00287">Bag.java:287</a></div></div>
<div class="ttc" id="interfacenars_1_1storage_1_1BagObserver_a11b5571052cf899abfac1e8930af0c4c_html_a11b5571052cf899abfac1e8930af0c4c"><div class="ttname"><a href="../../df/d32/interfacenars_1_1storage_1_1BagObserver_a11b5571052cf899abfac1e8930af0c4c.html#a11b5571052cf899abfac1e8930af0c4c">nars.storage.BagObserver.setTitle</a></div><div class="ttdeci">void setTitle(String title)</div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a4d2b0529a22c384840f63a7b463d62aa_html_a4d2b0529a22c384840f63a7b463d62aa"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a4d2b0529a22c384840f63a7b463d62aa.html#a4d2b0529a22c384840f63a7b463d62aa">nars.storage.Bag.showSizes</a></div><div class="ttdeci">String showSizes()</div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00373">Bag.java:373</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_acd6809918827ba68d36e467706eb05c0_html_acd6809918827ba68d36e467706eb05c0"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_acd6809918827ba68d36e467706eb05c0.html#acd6809918827ba68d36e467706eb05c0">nars.storage.Bag.memory</a></div><div class="ttdeci">Memory memory</div><div class="ttdoc">whether this bag has an active window </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00075">Bag.java:75</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_a57efe36feb5572fccb6f9a800621ad7d_html_a57efe36feb5572fccb6f9a800621ad7d"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_a57efe36feb5572fccb6f9a800621ad7d.html#a57efe36feb5572fccb6f9a800621ad7d">nars.storage.Bag.mass</a></div><div class="ttdeci">int mass</div><div class="ttdoc">current sum of occupied level </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00061">Bag.java:61</a></div></div>
<div class="ttc" id="classnars_1_1storage_1_1Bag_adff1bdb7ded17b66dc84068e49571ba7_html_adff1bdb7ded17b66dc84068e49571ba7"><div class="ttname"><a href="../../d9/d37/classnars_1_1storage_1_1Bag_adff1bdb7ded17b66dc84068e49571ba7.html#adff1bdb7ded17b66dc84068e49571ba7">nars.storage.Bag.toStringLong</a></div><div class="ttdeci">String toStringLong()</div><div class="ttdoc">TODO bad paste from preceding. </div><div class="ttdef"><b>Definition:</b> <a href="../../d6/dce/Bag_8java_source.html#l00358">Bag.java:358</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../dir_ed82ebcd34e530b246c6fd9032262140.html">aruntime</a></li><li class="navelem"><a class="el" href="../../dir_19496ddff8e6c0f2b6654287ecb1a472.html">src</a></li><li class="navelem"><a class="el" href="../../dir_db9c5934f797909f7296c2c2017f7fc9.html">main</a></li><li class="navelem"><a class="el" href="../../dir_6d74390eb6d6287951075e525bcb9bed.html">java</a></li><li class="navelem"><a class="el" href="../../dir_51a24984472456d47100350cd31f9a7c.html">nars</a></li><li class="navelem"><a class="el" href="../../dir_4abf5de01153d141bed7497320034a7d.html">storage</a></li><li class="navelem"><a class="el" href="../../d6/dce/Bag_8java.html">Bag.java</a></li>
    <li class="footer">Generated on Sun Jan 10 2016 18:03:58 for opennars by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
  </ul>
</div>
</body>
</html>
